﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// abstract Osoba typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class OsobaDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<OsobaDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.Osoba _currentOsoba = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxOsobaDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxOsobaErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxOsobaBindingSource;
		
		
		/// <summary> 
		/// the DGV column associated with the ID property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Ime property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxImeDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Prezime property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxPrezimeDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDMjestoRodenja property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDMjestoRodenjaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the MBG property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxMBGDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the OIB property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxOIBDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the ImeOca property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxImeOcaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the ImeMajke property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxImeMajkeDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the DatumRodenja property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDatumRodenjaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Napomena property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxNapomenaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the OsobniOdbitak property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxOsobniOdbitakDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Spol property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxSpolDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the StrucnaSprema property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxStrucnaSpremaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Drzavljanstvo property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDrzavljanstvoDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the RadnaDozvolaDaNe property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxRadnaDozvolaDaNeDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the RadnaDozvolaDatumIsteka property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxRadnaDozvolaDatumIstekaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Obrazovanje property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxObrazovanjeDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the StazDoDolaska property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxStazDoDolaskaDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
				
		private Entities.TList<Entities.Mjesto> _IDMjestoRodenjaList;
		
		/// <summary> 
		/// The list of selectable Mjesto
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Mjesto> IDMjestoRodenjaList
		{
			get {return this._IDMjestoRodenjaList;}
			set 
			{
				this._IDMjestoRodenjaList = value;
				this.uxIDMjestoRodenjaDataGridViewColumn.DataSource = null;
				this.uxIDMjestoRodenjaDataGridViewColumn.DataSource = this._IDMjestoRodenjaList;
			}
		}
		
		private bool _allowNewItemInIDMjestoRodenjaList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Mjesto
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDMjestoRodenjaList
		{
			get { return _allowNewItemInIDMjestoRodenjaList;}
			set
			{
				this._allowNewItemInIDMjestoRodenjaList = value;
				this.uxIDMjestoRodenjaDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.Osoba> _OsobaList;
				
		/// <summary> 
		/// The list of Osoba to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.Osoba> OsobaList
		{
			get {return this._OsobaList;}
			set
			{
				this._OsobaList = value;
				this.uxOsobaBindingSource.DataSource = null;
				this.uxOsobaBindingSource.DataSource = value;
				this.uxOsobaDataGridView.DataSource = null;
				this.uxOsobaDataGridView.DataSource = this.uxOsobaBindingSource;				
				//this.uxOsobaBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxOsobaBindingSource_ListChanged);
				this.uxOsobaBindingSource.CurrentItemChanged += new System.EventHandler(OnOsobaBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnOsobaBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentOsoba = uxOsobaBindingSource.Current as Entities.Osoba;
			
			if (_currentOsoba != null)
			{
				_currentOsoba.Validate();
			}
			//_Osoba.Validate();
			OnCurrentEntityChanged();
		}

		//void uxOsobaBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.Osoba"/> instance.
		/// </summary>
		public Entities.Osoba SelectedOsoba
		{
			get {return this._currentOsoba;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxOsobaDataGridView.VirtualMode;}
			set
			{
				this.uxOsobaDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxOsobaDataGridView.AllowUserToAddRows;}
			set {this.uxOsobaDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxOsobaDataGridView.AllowUserToDeleteRows;}
			set {this.uxOsobaDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxOsobaDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxOsobaDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="OsobaDataGridViewBase"/> class.
		/// </summary>
		public OsobaDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxOsobaDataGridView = new System.Windows.Forms.DataGridView();
			this.uxOsobaBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxOsobaErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIDDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxImeDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxPrezimeDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDMjestoRodenjaDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxMBGDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxOIBDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxImeOcaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxImeMajkeDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxDatumRodenjaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxNapomenaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxOsobniOdbitakDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxSpolDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxStrucnaSpremaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxDrzavljanstvoDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxRadnaDozvolaDaNeDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxRadnaDozvolaDatumIstekaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxObrazovanjeDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxStazDoDolaskaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			//this.uxIDMjestoRodenjaBindingSource = new MjestoBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDMjestoRodenjaBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOsobaDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOsobaBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOsobaErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxOsobaErrorProvider
			// 
			this.uxOsobaErrorProvider.ContainerControl = this;
			this.uxOsobaErrorProvider.DataSource = this.uxOsobaBindingSource;						
			// 
			// uxOsobaDataGridView
			// 
			this.uxOsobaDataGridView.AutoGenerateColumns = false;
			this.uxOsobaDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxOsobaDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIDDataGridViewColumn,
		this.uxImeDataGridViewColumn,
		this.uxPrezimeDataGridViewColumn,
		this.uxIDMjestoRodenjaDataGridViewColumn,
		this.uxMBGDataGridViewColumn,
		this.uxOIBDataGridViewColumn,
		this.uxImeOcaDataGridViewColumn,
		this.uxImeMajkeDataGridViewColumn,
		this.uxDatumRodenjaDataGridViewColumn,
		this.uxNapomenaDataGridViewColumn,
		this.uxOsobniOdbitakDataGridViewColumn,
		this.uxSpolDataGridViewColumn,
		this.uxStrucnaSpremaDataGridViewColumn,
		this.uxDrzavljanstvoDataGridViewColumn,
		this.uxRadnaDozvolaDaNeDataGridViewColumn,
		this.uxRadnaDozvolaDatumIstekaDataGridViewColumn,
		this.uxObrazovanjeDataGridViewColumn,
		this.uxStazDoDolaskaDataGridViewColumn			});
			this.uxOsobaDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxOsobaDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxOsobaDataGridView.Name = "uxOsobaDataGridView";
			this.uxOsobaDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxOsobaDataGridView.TabIndex = 0;	
			this.uxOsobaDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxOsobaDataGridView.EnableHeadersVisualStyles = false;
			this.uxOsobaDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnOsobaDataGridViewDataError);
			this.uxOsobaDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnOsobaDataGridViewCellValueNeeded);
			this.uxOsobaDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnOsobaDataGridViewCellValuePushed);
			
			//
			// uxIDDataGridViewColumn
			//
			this.uxIDDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDDataGridViewColumn.DataPropertyName = "ID";
			this.uxIDDataGridViewColumn.HeaderText = "ID";
			this.uxIDDataGridViewColumn.Name = "uxIDDataGridViewColumn";
			this.uxIDDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDDataGridViewColumn.ReadOnly = true;		
			//
			// uxImeDataGridViewColumn
			//
			this.uxImeDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxImeDataGridViewColumn.DataPropertyName = "Ime";
			this.uxImeDataGridViewColumn.HeaderText = "Ime";
			this.uxImeDataGridViewColumn.Name = "uxImeDataGridViewColumn";
			this.uxImeDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxImeDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxImeDataGridViewColumn.ReadOnly = false;		
			//
			// uxPrezimeDataGridViewColumn
			//
			this.uxPrezimeDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxPrezimeDataGridViewColumn.DataPropertyName = "Prezime";
			this.uxPrezimeDataGridViewColumn.HeaderText = "Prezime";
			this.uxPrezimeDataGridViewColumn.Name = "uxPrezimeDataGridViewColumn";
			this.uxPrezimeDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxPrezimeDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxPrezimeDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDMjestoRodenjaDataGridViewColumn
			//
			this.uxIDMjestoRodenjaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDMjestoRodenjaDataGridViewColumn.DataPropertyName = "IDMjestoRodenja";
			this.uxIDMjestoRodenjaDataGridViewColumn.HeaderText = "IDMjestoRodenja";
			this.uxIDMjestoRodenjaDataGridViewColumn.Name = "uxIDMjestoRodenjaDataGridViewColumn";
			this.uxIDMjestoRodenjaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDMjestoRodenjaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDMjestoRodenjaDataGridViewColumn.ReadOnly = false;		
			//
			// uxMBGDataGridViewColumn
			//
			this.uxMBGDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxMBGDataGridViewColumn.DataPropertyName = "MBG";
			this.uxMBGDataGridViewColumn.HeaderText = "MBG";
			this.uxMBGDataGridViewColumn.Name = "uxMBGDataGridViewColumn";
			this.uxMBGDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxMBGDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxMBGDataGridViewColumn.ReadOnly = false;		
			//
			// uxOIBDataGridViewColumn
			//
			this.uxOIBDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxOIBDataGridViewColumn.DataPropertyName = "OIB";
			this.uxOIBDataGridViewColumn.HeaderText = "OIB";
			this.uxOIBDataGridViewColumn.Name = "uxOIBDataGridViewColumn";
			this.uxOIBDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxOIBDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxOIBDataGridViewColumn.ReadOnly = false;		
			//
			// uxImeOcaDataGridViewColumn
			//
			this.uxImeOcaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxImeOcaDataGridViewColumn.DataPropertyName = "ImeOca";
			this.uxImeOcaDataGridViewColumn.HeaderText = "ImeOca";
			this.uxImeOcaDataGridViewColumn.Name = "uxImeOcaDataGridViewColumn";
			this.uxImeOcaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxImeOcaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxImeOcaDataGridViewColumn.ReadOnly = false;		
			//
			// uxImeMajkeDataGridViewColumn
			//
			this.uxImeMajkeDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxImeMajkeDataGridViewColumn.DataPropertyName = "ImeMajke";
			this.uxImeMajkeDataGridViewColumn.HeaderText = "ImeMajke";
			this.uxImeMajkeDataGridViewColumn.Name = "uxImeMajkeDataGridViewColumn";
			this.uxImeMajkeDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxImeMajkeDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxImeMajkeDataGridViewColumn.ReadOnly = false;		
			//
			// uxDatumRodenjaDataGridViewColumn
			//
			this.uxDatumRodenjaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDatumRodenjaDataGridViewColumn.DataPropertyName = "DatumRodenja";
			this.uxDatumRodenjaDataGridViewColumn.HeaderText = "DatumRodenja";
			this.uxDatumRodenjaDataGridViewColumn.Name = "uxDatumRodenjaDataGridViewColumn";
			this.uxDatumRodenjaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDatumRodenjaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDatumRodenjaDataGridViewColumn.ReadOnly = false;		
			//
			// uxNapomenaDataGridViewColumn
			//
			this.uxNapomenaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxNapomenaDataGridViewColumn.DataPropertyName = "Napomena";
			this.uxNapomenaDataGridViewColumn.HeaderText = "Napomena";
			this.uxNapomenaDataGridViewColumn.Name = "uxNapomenaDataGridViewColumn";
			this.uxNapomenaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxNapomenaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxNapomenaDataGridViewColumn.ReadOnly = false;		
			//
			// uxOsobniOdbitakDataGridViewColumn
			//
			this.uxOsobniOdbitakDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxOsobniOdbitakDataGridViewColumn.DataPropertyName = "OsobniOdbitak";
			this.uxOsobniOdbitakDataGridViewColumn.HeaderText = "OsobniOdbitak";
			this.uxOsobniOdbitakDataGridViewColumn.Name = "uxOsobniOdbitakDataGridViewColumn";
			this.uxOsobniOdbitakDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxOsobniOdbitakDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxOsobniOdbitakDataGridViewColumn.ReadOnly = false;		
			//
			// uxSpolDataGridViewColumn
			//
			this.uxSpolDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxSpolDataGridViewColumn.DataPropertyName = "Spol";
			this.uxSpolDataGridViewColumn.HeaderText = "Spol";
			this.uxSpolDataGridViewColumn.Name = "uxSpolDataGridViewColumn";
			this.uxSpolDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxSpolDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxSpolDataGridViewColumn.ReadOnly = false;		
			//
			// uxStrucnaSpremaDataGridViewColumn
			//
			this.uxStrucnaSpremaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxStrucnaSpremaDataGridViewColumn.DataPropertyName = "StrucnaSprema";
			this.uxStrucnaSpremaDataGridViewColumn.HeaderText = "StrucnaSprema";
			this.uxStrucnaSpremaDataGridViewColumn.Name = "uxStrucnaSpremaDataGridViewColumn";
			this.uxStrucnaSpremaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxStrucnaSpremaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxStrucnaSpremaDataGridViewColumn.ReadOnly = false;		
			//
			// uxDrzavljanstvoDataGridViewColumn
			//
			this.uxDrzavljanstvoDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDrzavljanstvoDataGridViewColumn.DataPropertyName = "Drzavljanstvo";
			this.uxDrzavljanstvoDataGridViewColumn.HeaderText = "Drzavljanstvo";
			this.uxDrzavljanstvoDataGridViewColumn.Name = "uxDrzavljanstvoDataGridViewColumn";
			this.uxDrzavljanstvoDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDrzavljanstvoDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDrzavljanstvoDataGridViewColumn.ReadOnly = false;		
			//
			// uxRadnaDozvolaDaNeDataGridViewColumn
			//
			this.uxRadnaDozvolaDaNeDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxRadnaDozvolaDaNeDataGridViewColumn.DataPropertyName = "RadnaDozvolaDaNe";
			this.uxRadnaDozvolaDaNeDataGridViewColumn.HeaderText = "RadnaDozvolaDaNe";
			this.uxRadnaDozvolaDaNeDataGridViewColumn.Name = "uxRadnaDozvolaDaNeDataGridViewColumn";
			this.uxRadnaDozvolaDaNeDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxRadnaDozvolaDaNeDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxRadnaDozvolaDaNeDataGridViewColumn.ReadOnly = false;		
			//
			// uxRadnaDozvolaDatumIstekaDataGridViewColumn
			//
			this.uxRadnaDozvolaDatumIstekaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxRadnaDozvolaDatumIstekaDataGridViewColumn.DataPropertyName = "RadnaDozvolaDatumIsteka";
			this.uxRadnaDozvolaDatumIstekaDataGridViewColumn.HeaderText = "RadnaDozvolaDatumIsteka";
			this.uxRadnaDozvolaDatumIstekaDataGridViewColumn.Name = "uxRadnaDozvolaDatumIstekaDataGridViewColumn";
			this.uxRadnaDozvolaDatumIstekaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxRadnaDozvolaDatumIstekaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxRadnaDozvolaDatumIstekaDataGridViewColumn.ReadOnly = false;		
			//
			// uxObrazovanjeDataGridViewColumn
			//
			this.uxObrazovanjeDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxObrazovanjeDataGridViewColumn.DataPropertyName = "Obrazovanje";
			this.uxObrazovanjeDataGridViewColumn.HeaderText = "Obrazovanje";
			this.uxObrazovanjeDataGridViewColumn.Name = "uxObrazovanjeDataGridViewColumn";
			this.uxObrazovanjeDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxObrazovanjeDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxObrazovanjeDataGridViewColumn.ReadOnly = false;		
			//
			// uxStazDoDolaskaDataGridViewColumn
			//
			this.uxStazDoDolaskaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxStazDoDolaskaDataGridViewColumn.DataPropertyName = "StazDoDolaska";
			this.uxStazDoDolaskaDataGridViewColumn.HeaderText = "StazDoDolaska";
			this.uxStazDoDolaskaDataGridViewColumn.Name = "uxStazDoDolaskaDataGridViewColumn";
			this.uxStazDoDolaskaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxStazDoDolaskaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxStazDoDolaskaDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDMjestoRodenjaDataGridViewColumn
			//				
			this.uxIDMjestoRodenjaDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDMjestoRodenjaDataGridViewColumn.ValueMember = "ID";	
			this.uxIDMjestoRodenjaDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDMjestoRodenjaDataGridViewColumn.DataSource = uxIDMjestoRodenjaBindingSource;				
				
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxOsobaDataGridView);
			this.Name = "OsobaDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDMjestoRodenjaBindingSource)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOsobaErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOsobaDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOsobaBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				OsobaDataGridViewEventArgs args = new OsobaDataGridViewEventArgs();
				args.Osoba = _currentOsoba;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class OsobaDataGridViewEventArgs : System.EventArgs
		{
			private Entities.Osoba	_Osoba;
	
			/// <summary>
			/// the  Entities.Osoba instance.
			/// </summary>
			public Entities.Osoba Osoba
			{
				get { return _Osoba; }
				set { _Osoba = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxOsobaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnOsobaDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxOsobaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnOsobaDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxOsobaDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						e.Value = OsobaList[e.RowIndex].ID;
						break;
					case "uxImeDataGridViewColumn":
						e.Value = OsobaList[e.RowIndex].Ime;
						break;
					case "uxPrezimeDataGridViewColumn":
						e.Value = OsobaList[e.RowIndex].Prezime;
						break;
					case "uxIDMjestoRodenjaDataGridViewColumn":
						e.Value = OsobaList[e.RowIndex].IDMjestoRodenja;
						break;
					case "uxMBGDataGridViewColumn":
						e.Value = OsobaList[e.RowIndex].MBG;
						break;
					case "uxOIBDataGridViewColumn":
						e.Value = OsobaList[e.RowIndex].OIB;
						break;
					case "uxImeOcaDataGridViewColumn":
						e.Value = OsobaList[e.RowIndex].ImeOca;
						break;
					case "uxImeMajkeDataGridViewColumn":
						e.Value = OsobaList[e.RowIndex].ImeMajke;
						break;
					case "uxDatumRodenjaDataGridViewColumn":
						e.Value = OsobaList[e.RowIndex].DatumRodenja;
						break;
					case "uxNapomenaDataGridViewColumn":
						e.Value = OsobaList[e.RowIndex].Napomena;
						break;
					case "uxOsobniOdbitakDataGridViewColumn":
						e.Value = OsobaList[e.RowIndex].OsobniOdbitak;
						break;
					case "uxSpolDataGridViewColumn":
						e.Value = OsobaList[e.RowIndex].Spol;
						break;
					case "uxStrucnaSpremaDataGridViewColumn":
						e.Value = OsobaList[e.RowIndex].StrucnaSprema;
						break;
					case "uxDrzavljanstvoDataGridViewColumn":
						e.Value = OsobaList[e.RowIndex].Drzavljanstvo;
						break;
					case "uxRadnaDozvolaDaNeDataGridViewColumn":
						e.Value = OsobaList[e.RowIndex].RadnaDozvolaDaNe;
						break;
					case "uxRadnaDozvolaDatumIstekaDataGridViewColumn":
						e.Value = OsobaList[e.RowIndex].RadnaDozvolaDatumIsteka;
						break;
					case "uxObrazovanjeDataGridViewColumn":
						e.Value = OsobaList[e.RowIndex].Obrazovanje;
						break;
					case "uxStazDoDolaskaDataGridViewColumn":
						e.Value = OsobaList[e.RowIndex].StazDoDolaska;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxOsobaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnOsobaDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxOsobaDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						OsobaList[e.RowIndex].ID = (System.Int32)e.Value;
						break;
					case "uxImeDataGridViewColumn":
						OsobaList[e.RowIndex].Ime = (System.String)e.Value;
						break;
					case "uxPrezimeDataGridViewColumn":
						OsobaList[e.RowIndex].Prezime = (System.String)e.Value;
						break;
					case "uxIDMjestoRodenjaDataGridViewColumn":
						OsobaList[e.RowIndex].IDMjestoRodenja = (System.Int32?)e.Value;
						break;
					case "uxMBGDataGridViewColumn":
						OsobaList[e.RowIndex].MBG = (System.String)e.Value;
						break;
					case "uxOIBDataGridViewColumn":
						OsobaList[e.RowIndex].OIB = (System.String)e.Value;
						break;
					case "uxImeOcaDataGridViewColumn":
						OsobaList[e.RowIndex].ImeOca = (System.String)e.Value;
						break;
					case "uxImeMajkeDataGridViewColumn":
						OsobaList[e.RowIndex].ImeMajke = (System.String)e.Value;
						break;
					case "uxDatumRodenjaDataGridViewColumn":
						OsobaList[e.RowIndex].DatumRodenja = (System.DateTime?)e.Value;
						break;
					case "uxNapomenaDataGridViewColumn":
						OsobaList[e.RowIndex].Napomena = (System.String)e.Value;
						break;
					case "uxOsobniOdbitakDataGridViewColumn":
						OsobaList[e.RowIndex].OsobniOdbitak = (System.Single)e.Value;
						break;
					case "uxSpolDataGridViewColumn":
						OsobaList[e.RowIndex].Spol = (System.Int32?)e.Value;
						break;
					case "uxStrucnaSpremaDataGridViewColumn":
						OsobaList[e.RowIndex].StrucnaSprema = (System.Int32?)e.Value;
						break;
					case "uxDrzavljanstvoDataGridViewColumn":
						OsobaList[e.RowIndex].Drzavljanstvo = (System.String)e.Value;
						break;
					case "uxRadnaDozvolaDaNeDataGridViewColumn":
						OsobaList[e.RowIndex].RadnaDozvolaDaNe = (System.Int32?)e.Value;
						break;
					case "uxRadnaDozvolaDatumIstekaDataGridViewColumn":
						OsobaList[e.RowIndex].RadnaDozvolaDatumIsteka = (System.DateTime?)e.Value;
						break;
					case "uxObrazovanjeDataGridViewColumn":
						OsobaList[e.RowIndex].Obrazovanje = (System.String)e.Value;
						break;
					case "uxStazDoDolaskaDataGridViewColumn":
						OsobaList[e.RowIndex].StazDoDolaska = (System.String)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
